import { expect } from 'chai';
import { generateOptionsArray } from '../src/util';

describe('generateOptionsArray', () => {
    it('should handle a single option without spaces', () => {
        const result = generateOptionsArray('option1');
        expect(result).to.deep.equal(['option1']);
    });

    it('should handle multiple options with spaces', () => {
        const result = generateOptionsArray('option1 option2 option3');
        expect(result).to.deep.equal(['option1', 'option2', 'option3']);
    });

    it('should trim spaces around options', () => {
        const result = generateOptionsArray('  option1   option2  option3 ');
        expect(result).to.deep.equal(['option1', 'option2', 'option3']);
    });

    it('should handle leading and trailing spaces in the input string', () => {
        const result = generateOptionsArray('  option1 option2 option3 ');
        expect(result).to.deep.equal(['option1', 'option2', 'option3']);
    });

    it('should return an empty array for an empty string', () => {
        const result = generateOptionsArray('');
        expect(result).to.deep.equal([]);
    });

    it('should return an empty array for a string with only spaces', () => {
        const result = generateOptionsArray('   ');
        expect(result).to.deep.equal([]);
    });

    it('should handle options with quotes', () => {
        const result = generateOptionsArray('option1 "option2 with spaces" option3');
        expect(result).to.deep.equal(['option1', 'option2 with spaces', 'option3']);
    });
});
